﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HostAssistantCore
{
    public static class UFormat
    {
        public static string UString(this object source)
        {
            if (source == null || source == DBNull.Value)
            {
                return string.Empty;
            }
            return Convert.ToString(source);
        }

        public static int UInt(this object source)
        {
            if (source == null || source == DBNull.Value)
            {
                return 0;
            }
            return Convert.ToInt32(source);
        }

        public static bool UBool(this object source)
        {
            if (source == null || source == DBNull.Value)
            {
                return false;
            }
            return Convert.ToBoolean(source);
        }
    }
}
